import request from '@/utils/request';

/**
 * 查询分类列表
 *
 * @param {object} query
 */
export const listCategory = (query:any) => {
	return request({
		url: '/rwmanage/classify/list',
		method: 'get',
		params: query
	});
};

/**
 * 查询分类详细
 *
 * @param {string} id
 */
export const getCategory = (id:string) => {
	return request({
		url: '/rwmanage/classify/' + id,
		method: 'get'
	});
};

/**
 * 新增分类
 *
 * @param {object} data
 */
export const addCategory = (data:any) => {
	return request({
		url: '/rwmanage/classify/add',
		method: 'post',
		data: data
	});
};

/**
 *  修改分类
 *
 * @param {object} data
 */
export const updateCategory = (data:any) => {
	return request({
		url: '/rwmanage/classify/edit',
		method: 'put',
		data: data
	});
};

/**
 * 删除分类
 *
 * @param {string} id
 */
export const delCategory = (id:string) => {
	return request({
		url: '/rwmanage/classify/' + id,
		method: 'delete'
	});
};

// /**
//  * 导出分类
//  *
//  * @param {object} query
//  */
// export const exportCategory = query => {
// 	return request({
// 		url: '/rwmanage/classify/export',
// 		method: 'get',
// 		params: query
// 	});
// };

/**
 * 导出分类(返回流)
 *
 * @param {object} query
 */
export const exportCategory = (query:any) => {
	return request({
		url: '/rwmanage/classify/exportByStream',
		method: 'post',
		data: query
	});
};
